package com.cf.sms.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.freemarker.FreeMarkerProperties;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;
import java.util.Arrays;

/**
 * boot-message-WebMessageConfig
 *
 * @author <a href="2428922347@qq.com">Zhu mingming</a>
 * @info
 * @since 2018/7/12 下午 03:07
 */
@Slf4j
@Configuration
public class SmsAdminConfig implements InitializingBean {

    @Autowired
    private FreeMarkerProperties freeMarkerProperties;

    @Override
    public void afterPropertiesSet() throws Exception {
        String[] templateLoaderPath = freeMarkerProperties.getTemplateLoaderPath();
        ArrayList<String> paths = new ArrayList();
        paths.addAll(Arrays.asList(templateLoaderPath));
        paths.add("classpath:/template-smsLog/");
        String[] strings = paths.toArray(new String[paths.size()]);
        freeMarkerProperties.setTemplateLoaderPath(strings);
    }

}
